package spring.cloud.tasks.executor.node;

import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@Setter
@Getter
public final class TaskNodePaths {

    public static final String TASK_NODE_NAME = "$tasks";

    public static final String ROOT = "/" + TASK_NODE_NAME;

    /**
     * 获取作业节点全路径
     *
     * @return 作业节点全路径
     */
    public static String getTaskPath(String taskId) {
        return String.format("/%s/%s", TASK_NODE_NAME, taskId);
    }

    public static String getTaskNodePath(final String taskId, final String node) {
        return String.format("/%s/%s/%s", TASK_NODE_NAME, taskId, node);
    }

    public static String getConfigNodePath(final String taskId, final String nodeName) {
        return String.format("/%s/%s/config/%s", TASK_NODE_NAME, taskId, nodeName);
    }

    public static String getExecutorNodePath(final String taskId, final String executorId) {
        return String.format("/%s/%s/servers/%s", TASK_NODE_NAME, taskId, executorId);
    }

}
